<?php
require_once('../../config.php');
Doctrine::loadModels('../../models');

	$query = new Doctrine_Query();
    $query->from('LkGlossary l')
    			->where('l.category_id = 45 OR l.item_id = 23')
            	->orderby('l.item_value, l.item_name');
    $items = $query->execute();	
    
    file_put_contents  ( "select_all.txt", $items);

/// Return XML
$str.='<results>';
	foreach ($items as $item){
		$str.='<record>';
			$str.='<data>'.$item["item_id"].'</data>';
			$str.='<label>'.$item["item_name"].'</label>';
		$str.='</record>';
	}
$str.='</results>';
   
header ("content-type: text/xml"); 
echo $str;

file_put_contents  ( "out.txt", $str);

?>